<!-- debut de section principale -->
<form name="InvoiceAddEdit" method="post" action="InvoiceAddEdit.php"
    onsubmit="return validation();" class="form">
   <table border="0" cellspacing="0" cellpadding="5" width="100%" class="form" style="border: 1px #000000 solid;">
     <thead>
   		<tr>
 		<td colspan="4">
         &nbsp; {t}Order billing{/t} : {$CommandNo} ({t}Order{/t} {$CmdType})
         <input type="hidden" name="port_tva_rate" value="{$port_tva_rate|default:'0'}" />
         <input type="hidden" name="packing_tva_rate" value="{$packing_tva_rate|default:'0'}" />
         <input type="hidden" name="insurance_tva_rate" value="{$insurance_tva_rate|default:'0'}" />
         <input type="hidden" name="returnURL" value="{$returnURL}" />
         </td>
 	</tr>
	</thead>
	<tbody>
	<tr>
 		<td width="25%">&nbsp;<b>{t}Invoice number{/t} :</b></td>
         <td width="25%"><input type="text" size="15" name="InvoiceNumero" value="" /></td>
 	{if $displayEditionDate==1}
 		  <td nowrap colspan="2"><b>{t}Invoice issue date{/t}:</b>&nbsp;
			<span id="show_Date" style="background-color:#E1E8EF;border:1px #000000 dotted;
				margin: 3px 3px 3px 3px;padding: 3px 3px 3px 3px;text-align: right;">
				{$Invoice_EditionDate_Format}
			</span>
            <input type="hidden" name="Invoice_EditionDate" id="f_date" value="{$Invoice_EditionDate}" />
            &nbsp;
			<input type="button" name="f_trigger" id="f_trigger" value="..."
                style="cursor: pointer;" title="{t}Select a date{/t}" /></td>
	{else}
 		  <td colspan="2">&nbsp;</td>
 	{/if}
 	</tr>
 	<tr>
 		<td>&nbsp;<b>{t}Terms of payment{/t} :</b></td>
 		<td>{$TermsOfPayment}</td>
 		<td width="25%"><b>{t}Current outstanding debts{/t} {$Currency}:</b>
 			<input type="hidden"name="UpdateIncur" value="{$UpdateIncur}" />
 			<input type="hidden" name="HiddenCmdType" value="{$CmdType}" />
 			<input type="hidden" name="HiddenPaymentCondition" value="{$HiddenPaymentCondition}" />
 		</td>
 		<td width="25%">{$UpdateIncur}</td>
 	</tr>
 	<tr>
 		<td>&nbsp;<b>{t}Credit note available{/t} {$Currency}:</b></td>
 		<td>{$ToHaveTTC}</td>
 		<td><b>{t}Maximum outstanding debts{/t} {$Currency}:</b>
            <input type="hidden" name="MaxIncur" value="{$MaxIncur}" /></td>
 	    <td>{$MaxIncur}</td>
     </tr>
    </tbody>
 </table>
 <br />
 {$InvoiceItemGrid}
 <table border="0" cellspacing="0" cellpadding="5" width="100%" class="form">
   <thead>
 	<tr>
 		<td colspan="7" valign="baseline">
 			<input type="checkbox" name="CoutPortPackingInsurance"
 				onclick="CoutPortPackingInsuranceClick();RecalculateTotal();" />
 			&nbsp; {t}Take into account delivery, insurance and packing charges.{/t}
 		</td>
     </tr>
   </thead>
 </table>
 <table border="0" cellspacing="0" cellpadding="5" width="100%" class="form">
   <tbody>
 	<tr>
 		<td width="20%">&nbsp;<strong>{t}Delivery expenses{/t} {$Currency}:</strong>&nbsp;</td>
 		<td><input type="text" size="7" name="Port" value={$Port} onkeyup="RecalculateTotal()" />
            <input type="hidden" name="hiddenPortTVA" value="0" />
         </td>
 		<td width="20%">&nbsp;{if $CmdType == "Client"}<strong>{t}Customer discount{/t} % :</strong>{/if}&nbsp;</td>
 		<td>{$CustomerRemExcep|default:"&nbsp;"}
 	</tr>
 	<tr>
 		<td>&nbsp;<strong>{t}Packing{/t} {$Currency}:</strong>&nbsp;</td>
 		<td><input type="text" size="7" name="Emballage" value={$Packing}
          onkeyup="RecalculateTotal()" />
         <input type="hidden" name="hiddenEmballageTVA" value="0" />
         </td>
 		<td>&nbsp;</td>
 		<td>&nbsp;</td>
 	</tr>
 	<tr>
 		<td>&nbsp;<strong>{t}Insurance{/t} {$Currency}:&nbsp;</strong></td>
 		<td><input type="text" size="7" name="Assurance" value={$Insurance}
          onkeyup="RecalculateTotal()" />
 		  <input type="hidden" name="hiddenHasInvoice" value={$HasInvoice} />
          <input type="hidden" name="hiddenAssuranceTVA" value="0" />
          <input type="hidden" name="tvaSurtaxRate" value="{$TvaSurtaxRate}" id="tvaSurtaxRate" />
          <input type="hidden" name="fodecTaxRate" value="{$FodecTaxRate}" />
          <input type="hidden" name="taxStamp" value="{$TaxStamp}" />
         </td>
 		{if $HasInvoice == 1}
 		<td>&nbsp;<strong>{t}Instalment{/t} {$Currency}:</strong>&nbsp;</td>
 		<td><input type="text" size="10" name="Instalment" class="ReadOnlyField"
            readonly="readonly" value="{$Instalment}" /></td>
 		{else}
 		<td colspan="2">&nbsp;</td>
 		{/if}
 	</tr>
   </tbody>
 </table>
 <table border="0" cellspacing="0" cellpadding="5" width="100%" class="form">
   <thead>
   <tr>
 		<td width="8%" rowspan="3">{t}VAT{/t} {$Currency} :&nbsp;</td>
		<td width="12%" rowspan="3" align="right">
{foreach key=key item=item from=$tvaRateArray}
	<div style="height: 13px;padding: 3px 3px 3px 3px;">{$key} %</div><br />
{/foreach}
{if $TvaSurtaxRate neq '0'} 
    <div style="height: 13px;padding: 3px 3px 3px 3px;">{t}VAT surtax{/t}&nbsp; %</div><br />
{/if}
{if $FodecTaxRate neq '0'}
    <div style="height: 13px;padding: 3px 3px 3px 3px;">{t}FODEC tax{/t}&nbsp;{$FodecTaxRateFormated} %</div><br />
{/if}
{if $TaxStamp neq '0'}
    <div style="height: 13px;padding: 3px 3px 3px 3px;">{t}Tax stamp{/t}&nbsp;{$Currency}</div><br />
{/if}
		</td>
		<td rowspan="3">
{foreach key=key item=item from=$tvaRateArray}
	<input type="text" size="10" name="tvaTotal[]" class="ReadOnlyField"
        readonly="readonly" value="0" />&nbsp;&nbsp;&nbsp;
    <input type="hidden" name="tvaTotalRate[]" value="{$item}" /><br /><br />
{/foreach}
{if $TvaSurtaxRate neq '0'} <input type="text" size="10" name="tvaSurtax" class="ReadOnlyField"
        readonly="readonly" value="{$TvaSurtaxRateFormated}" id="tvaSurtax" />
{else}
<input type="hidden" name="tvaSurtax" value="0" id="tvaSurtax" />
{/if}	
{if $FodecTaxRate neq '0'} <br /><br /><input type="text" size="10" name="fodecTax" class="ReadOnlyField"
        readonly="readonly" value="0" />
{else}
<input type="hidden" name="fodecTax" value="0" />
{/if}	
{if $TaxStamp neq '0'} <br /><br /><input type="text" size="10" name="taxStampFormated" class="ReadOnlyField"
        readonly="readonly" value="{$TaxStampFormated}" />	
{/if}	
        </td>
		<td>{t}Global discount{/t} % :</td>
        {if $HandingByRangePercent}
        <td><input type="text" size="7" name="GlobalHanding" value={$GlobalHanding} 
            readonly="readonly" class="ReadOnlyField"/><br/>{$HandingByRangePercent}
        </td>
        {else}
		<td><input type="text" size="7" name="GlobalHanding" value={$GlobalHanding}
            onkeyUp="RecalculateTotal(true);" /></td>
        {/if}
 		<td>{t}Total price{/t} {$Currency} {t}Total excl. VAT before global discount{/t} :&nbsp;</td>
 		<td><input type="text" size="10" name="totalpriceHTBeforeDiscount"
            class="ReadOnlyField" readonly="readonly" value="0" /></td>
 	</tr>
 	<tr>
 		<td>{t}Amount{/t} {$Currency} {t}of global discount{/t} : </td>
 		<td><input type="text" size="10" name="GlobalDiscount" class="ReadOnlyField"
            readonly="readonly" value="0" /></td>
 		<td>{t}Total price{/t} {$Currency} {t}excl. VAT{/t} :&nbsp;</td>
 		<td><input type="text" size="10" name="totalpriceHT" class="ReadOnlyField"
            readonly="readonly" value="0" /></td>
 	</tr>
    <tr>
        <td colspan="2">&nbsp;</td>
 		<td>{t}Total price{/t} {$Currency} {t}incl. VAT{/t} :&nbsp;</td>
 		<td><input type="text" size="10" name="totalpriceTTC" class="ReadOnlyField"
            readonly="readonly" value="0" /></td>
 	</tr>
     {if $HasInvoice == 1}
 	<tr>
 		<td colspan="5">&nbsp;</td>
 		<td> {t}To pay{/t} {$Currency}:&nbsp;</td>
 		<td><input type="text" size="10" name="ToPay" class="ReadOnlyField"
            readonly="readonly" value="0" /></td>
 	</tr>
 	{/if}
   </thead>
 </table>
 <table border="0" cellspacing="0" cellpadding="5" width="100%" style="margin-top:5pt; margin-bottom:5pt;">
 	<tr>
 		<td align="right" valign=top>
 			<b>{t}Comment{/t}:</b>
 		</td>
 		<td align="left" width=100%>
 			<textarea name="IAEComment" rows="3" cols="50"></textarea>
 		</td>
 	</tr>
 </table>
 <table border="0" cellspacing="0" cellpadding="5" width="100%" class="form">
   <tfoot>
 	<tr>
 		<td align="right" colspan="7">
 			<input type="hidden" name="FormSubmitted" value="" />
             <input type="hidden" name="HiddenCommandID" value="{$HiddenCommandID}" />
       		<input name="envoyer" type="submit" onclick="FormSubmitted.value='true';"
               value="{t}Ok{/t}" class="Button" />
 			<input name="annuler" type="button" onclick="window.location='InvoiceCommandList.php?CommandId={$HiddenCommandID}'"
              value="{t}List of invoices{/t}" class="Button" />
 			<input name="retour" type="button" onclick="window.location='{$returnURL}'"
             value="{t}Cancel{/t}" class="Button" />
 		</td>
 	</tr>
   </tfoot>
 </table>

</form>
{if $displayEditionDate==1}
{literal}
<script type="text/javascript">
<!--
// <![CDATA[
	Calendar.setup({
        inputField     :    "f_date",         // id of the input field (hidden)
        ifFormat       :    "%Y-%m-%d %H:%M:00",  // format of the input field
		displayArea    :    "show_Date",         // ID of the span where the date is to be shown
		daFormat       :    "%A %e %B %Y %H:%M",  // format of the displayed date
        button         :    "f_trigger",       // trigger for the calendar (button ID)
        align          :    "Tl",                 // alignment (defaults to "Bl")
		date		   :	"", 				  // date affichee par defaut
        singleClick    :    true,
		dateStatusFunc :	dateStatusHandler     // permet d'afficher des dates speciales diffaremment (jours feries)
    });
// ]]>
-->
</script>
{/literal}
{/if}
 <!-- fin de section principale -->
